Skip to content

Fix needs saving mark 2 - for #576 #658

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 12 commits into from
Sep 7, 2018

Conversation

jareddonovan
Copy link
Contributor

Before your pull request is reviewed and merged, please ensure that:

  • there are no linting errors -- npm run lint
  • your code is in a uniquely-named feature branch and has been rebased on top of the latest master. If you're asked to make more changes, make sure you rebase onto master then too!
  • your pull request is descriptively named and links to an issue number, i.e. Fixes #123

This is a work in progress pull request to address #576 based on advice from @catarak and @shinytang6 on my previous pull request (#652).

I am trying to move the properties isOptionsOpen and isEditingName to be stored as state in the FileNode component, rather than going into the Redux state. This PR just does this for isOptionsOpen. I want to check that I'm on the right track and am not doing anything too heinous...

@catarak
Copy link
Member

catarak commented Jun 27, 2018

yeah this is looking great! the only suggestion i have is to remove all of the commented out code.

@jareddonovan
Copy link
Contributor Author

jareddonovan commented Jun 28, 2018

Thanks @catarak - I've completed the changes for isEditingName too. Have also removed commented out code.

One question I had, which you can maybe advise on: Should I be binding the event handlers I've added to the FileNode component to this in the constructor for that?

This appears to work fine on my local installation and solves the problem of the needs saving mark not being removed.

@catarak
Copy link
Member

catarak commented Jun 28, 2018

Yes! The event handlers should be bound to this in the constructor. The reason for this is so that in the event handler, you can access the state of the React component (which is this). If you don't bind it, then I think by default this is the HTML element that the event handler is added to, though I'm not 100% sure on that.

@jareddonovan
Copy link
Contributor Author

@catarak - great! I actually did do that in the latest changes, so I think that means that this PR is complete and will leave it from you for here.

@jareddonovan jareddonovan changed the title Fix needs saving mark 2 - WIP for #576 Fix needs saving mark 2 - for #576 Jun 29, 2018
@catarak
Copy link
Member

catarak commented Jul 3, 2018

this looks great! i noticed a bug, which is if you rename a file, it doesn't save the sketch, or mark it as unsaved. i think that when you rename a file, the sketch should save.

@bendman
Copy link
Contributor

bendman commented Sep 5, 2018

@catarak Is this PR just waiting for a fix to this last bug?

[...] i noticed a bug, which is if you rename a file, it doesn't save the sketch, or mark it as unsaved. i think that when you rename a file, the sketch should save.

@catarak
Copy link
Member

catarak commented Sep 5, 2018

@bendman yes! feel free to pick up and fix. i don't think it makes sense to merge this in as it is now since the bug i found is a regression.

@bendman
Copy link
Contributor

bendman commented Sep 7, 2018

@catarak I'm working on this one now, but I'm not understanding how to reproduce the regressive bug. Right now on the live site I also see the bug where renaming a file doesn't save the sketch or mark it as unsaved.

This happens on the live site and this branch for me: If I rename a file, it doesn't save it or mark it as unsaved. If I reload the project, the file will have the original name.
p5-save-bug

The existing behavior is kind of weird though. Should I try to include a fix in this branch by saving the project once a file is renamed?

@catarak
Copy link
Member

catarak commented Sep 7, 2018

@bendman you're right! i think i was mixed up since when you change the sketch name, the sketch automatically saves, and now i'm wondering if that should be the same behavior for files, or if the sketch should set its state to having unsaved changes. i'll put this in a separate ticket.

let me take a second pass at this PR and see if there are any other changes to be made, otherwise i will actually merge it in.

@catarak
Copy link
Member

catarak commented Sep 7, 2018

just tested again, and this is working great. hopefully this also fixes #675. going to merge this!

@catarak catarak merged commit 2f21130 into processing:master Sep 7, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants